<template>
  <div class="inp">
    <input v-model="inpText" @keydown.enter="send" type="text" name="" id="">
    <span @click="send" class="iconfont">&#xe659;</span>
  </div>
</template>

<script>
export default {
  name: "ChatInp",
  
  data() {
    return {
      inpText: ""
    }
  },

  methods: {
    send() {
      this.$emit("input", this.inpText)
      this.inpText = ""
    }
  }
}
</script>

<style lang="scss">
.inp {
  border: 1px solid #ccc;
  margin: 15px;
  height: 30px;
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  padding: 0 10px;
  box-sizing: border-box;
  align-items: center;

  input {
    height: 100%;
    flex: 1;
  }

  .iconfont {
    text-align: center;
    color: #ccc;
    width: 30px;
    cursor: pointer;
    user-select: none;
  }

  @media (max-width: 800px) {
    height: 50px;
  }
}
</style>